import { defHttp } from '/@/utils/http/axios';
import { useGlobSetting } from '/@/hooks/setting';
import { BasicModel } from '../model/baseModel';

const { adminPath } = useGlobSetting();

export interface BaseApiReq extends BasicModel<BaseApiReq> {
 
}

export interface BadeApiResult extends BasicModel<BadeApiResult> {

}

export const addUserStocks = (params?: any, data?: any) => {
  
  return defHttp.postJson<BadeApiResult>({ url: adminPath+'/userstocks/addUserStocks', params, data});
}

export const addUserPage = (params?: any, data?: any) => {
  return defHttp.postJson<BadeApiResult>({ url: adminPath+'/userstocks/addUserPage', params, data});
}

export const deleteUserStock = (params?: any, data?: any) => {
  return defHttp.postJson<BadeApiResult>({ url: adminPath+'/userstocks/deleteUserStock', params, data});
}

export const updateUserPageName = (params?: any, data?: any) => {
  console.log('updateUserPageName', data)
  return defHttp.postJson<BadeApiResult>({ url: adminPath+'/userstocks/updateUserPageName', params, data});
}

export const getUserPages = (params?: any) => {
  var userId = params['userId'];
  return defHttp.get<Recordable>({ url: adminPath+'/userstocks/getUserPages/'+userId });
}

export const findUserPageStockList = (params?: any, data?: any) => {
  return defHttp.postJson<BadeApiResult>({ url: adminPath+'/userstocks/findUserPageStockList' ,params, data});
}

export const deleteUserPage = (params?: any) => {
  var ids = params['ids'];
  return defHttp.get<Recordable>({ url: adminPath+'/userstocks/deleteUserPage/'+ids ,params});
}

export const stockInUserStock = (params?: any) => {
  var {userId, stockCode} = params;
  return defHttp.get<Recordable>({ url: adminPath+'/userstocks/stockInUserStock/'+userId+'/'+stockCode ,params});
}

export const exportStocks = (params?: any, data?: any) => {
  return defHttp.request<Recordable>({ url: adminPath+'/userstocks/exportStocks' ,params});
}

export const saveUserPageZbConfig = (params?: any, data?: any) => {
  return defHttp.postJson<BadeApiResult>({ url: adminPath+'/userstocks/saveUserPageZbConfig', params, data});
}

export const getUserPageByPageName = (params?: any) => {
  var {userId, pageName} = params;
  return defHttp.get<Recordable>({ url: adminPath+'/userstocks/getUserPage/'+userId+'/'+pageName ,params});
}





